package com.ylsk.check.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ylsk.common.annotation.Log;
import com.ylsk.common.core.controller.BaseController;
import com.ylsk.common.core.domain.AjaxResult;
import com.ylsk.common.enums.BusinessType;
import com.ylsk.check.domain.CheckDiagramSign;
import com.ylsk.check.service.ICheckDiagramSignService;
import com.ylsk.common.utils.poi.ExcelUtil;
import com.ylsk.common.core.page.TableDataInfo;

/**
 * 施工检查示意图标志Controller
 * 
 * @author yangsy
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/check/checkDiagramSign")
public class CheckDiagramSignController extends BaseController
{
    @Autowired
    private ICheckDiagramSignService checkDiagramSignService;

    /**
     * 查询施工检查示意图标志列表
     */
    @PreAuthorize("@ss.hasPermi('check:checkDiagramSign:list')")
    @GetMapping("/list")
    public TableDataInfo list(CheckDiagramSign checkDiagramSign)
    {
        startPage();
        List<CheckDiagramSign> list = checkDiagramSignService.selectCheckDiagramSignList(checkDiagramSign);
        return getDataTable(list);
    }

    /**
     * 导出施工检查示意图标志列表
     */
    @PreAuthorize("@ss.hasPermi('check:checkDiagramSign:export')")
    @Log(title = "施工检查示意图标志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CheckDiagramSign checkDiagramSign)
    {
        List<CheckDiagramSign> list = checkDiagramSignService.selectCheckDiagramSignList(checkDiagramSign);
        ExcelUtil<CheckDiagramSign> util = new ExcelUtil<CheckDiagramSign>(CheckDiagramSign.class);
        util.exportExcel(response, list, "施工检查示意图标志数据");
    }

    /**
     * 获取施工检查示意图标志详细信息
     */
    @PreAuthorize("@ss.hasPermi('check:checkDiagramSign:query')")
    @GetMapping(value = "/{checkDiagramSignId}")
    public AjaxResult getInfo(@PathVariable("checkDiagramSignId") Long checkDiagramSignId)
    {
        return success(checkDiagramSignService.selectCheckDiagramSignByCheckDiagramSignId(checkDiagramSignId));
    }

    /**
     * 新增施工检查示意图标志
     */
    @PreAuthorize("@ss.hasPermi('check:checkDiagramSign:add')")
    @Log(title = "施工检查示意图标志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CheckDiagramSign checkDiagramSign)
    {
        return toAjax(checkDiagramSignService.insertCheckDiagramSign(checkDiagramSign));
    }

    /**
     * 修改施工检查示意图标志
     */
    @PreAuthorize("@ss.hasPermi('check:checkDiagramSign:edit')")
    @Log(title = "施工检查示意图标志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CheckDiagramSign checkDiagramSign)
    {
        return toAjax(checkDiagramSignService.updateCheckDiagramSign(checkDiagramSign));
    }

    /**
     * 删除施工检查示意图标志
     */
    @PreAuthorize("@ss.hasPermi('check:checkDiagramSign:remove')")
    @Log(title = "施工检查示意图标志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{checkDiagramSignIds}")
    public AjaxResult remove(@PathVariable Long[] checkDiagramSignIds)
    {
        return toAjax(checkDiagramSignService.deleteCheckDiagramSignByCheckDiagramSignIds(checkDiagramSignIds));
    }
}
